package org.example.codeservce.api;

import com.alibaba.dashscope.app.Application;
import com.alibaba.dashscope.app.ApplicationResult;
import com.alibaba.dashscope.app.RagApplicationParam;
import lombok.SneakyThrows;

/**
 * @author: Li Qing
 * @date: 2024/5/10 11:20
 * @description: 同义千问
 */
public class TongYiUtil
{

    @SneakyThrows
    public static String inquire(String prompt)
    {
        RagApplicationParam param = RagApplicationParam.builder()
                .appId("b52eea9b290342818e5404017aeafa86")
                .apiKey("sk-IeCCaRJJcT")
                .prompt(prompt)
                .build();
        Application application = new Application();
        ApplicationResult result = application.call(param);
        return result.getOutput().getText();
    }
}
